<template>
    <div style="height:auto;">
    <div class="wrap flex_column" style="background:#f5f5f5;">
        <div v-if="detail" 
        :class="{sort1:i=='noonList',sort2:i=='nightList',sort3:i=='lessonList',
        sort4:i=='taskList',sort5:i=='examList',sort6:i=='recipeList',sort7:i=='tsHealthEntity'}"
         v-for="(item,i) in detail">
            <div  v-if="i=='noonList'||i=='nightList'||i=='lessonList'" class="flex_column text_row2">
                <div class="row_title">{{formatTitle(i)}}</div>
                <div>
                <span v-if="detail[i].length>0" >
                    <span v-for="(obj,j) in detail[i]" style="margin-right:0.2rem;">
                        {{formatType(obj.markFlag)}}：{{new Date(obj.markTime).Format('hh:mm:ss')}}
                    </span>
                </span>
                <span v-if="detail[i].length==0">
                    无
                </span>
                </div>
            </div>
            <div v-if="i=='taskList'" class="flex_column text_row2">
                <div class="row_title">{{formatTitle(i)}}</div>
                <span v-if="detail[i].length==0">
                        无
                </span>
                <ul style="width:100%;font-size:0.3rem;">
                    <li v-for='(item,index) in detail[i]' class="wrap">
                        <div class="personal flex_wrap">
                        <div class="touxiang">
                            <img :src="item.teacherPhoto" />
                        </div>
                        <div class="useinfo">
                            <div class="usename" style="padding-top:0;">{{item.teacherName}}</div>
                            <div class="time">{{new Date(item.createTime).Format('yyyy-MM-dd hh:mm')}}</div>
                        </div>
                        </div>
                        <div class="flex_wrap" style="margin-bottom:0.15rem;justify-content:space-between;">
                        <div class="flex_wrap">
                            <div>作业表现</div>
                            <div class="start_wrap" style="justify-content: flex-start;">
                            <div class="start1" v-for="i in item.taskLevel"></div>
                            </div>
                        </div>
                        <div class="flex_wrap">
                            <div>行为表现</div>
                            <div class="start_wrap" style="justify-content: flex-start">
                            <div class="start1" v-for="i in item.behaviorLevel"></div>
                            </div>
                        </div>
                        </div>
                        <div class="img_wrap">
                        <img v-for='(img,index) in item.filePathList' v-if="img.fileType==1"  @click.stop="$api.showImgDetail(img.filePath)" :src=$api.formatterImg(img.filePath) />
                        </div>
                        <div class="audio_wrap">
                        <audio v-for='(audio,index) in item.filePathList' v-if="audio.fileType==2" :src=audio.filePath></audio>
                        </div>
                        <div class="dianping" v-html="item.bodyComment"></div>
                        <div class="flex_wrap" style="margin-bottom:0.2rem;">
                        <div v-for="impress in item.allImpression" v-if="impress.isCheck" class="impress">
                            {{impress.text}}
                        </div>
                        </div>
                    </li>
                </ul>
            </div>
            <div v-if="i=='examList'" class="flex_column text_row2">
                <div class="row_title">{{formatTitle(i)}}</div>
                <span v-if="detail[i].length==0">
                        无
                </span>
                <li v-for='(item,index) in detail[i]' class="wrap">
                    <div class="personal flex_wrap">
                        <div class="touxiang">
                        <img :src="item.teacherPhoto" />
                        </div>
                        <div class="useinfo">
                        <div class="usename" style="padding-top:0;">{{item.teacherName}}</div>
                        <div class="time">{{new Date(item.createTime).Format('yyyy-MM-dd hh:mm')}}</div>
                        </div>
                        <div class="biaoxian">
                        <div class="score">{{item.score}}分</div>
                        <div class="start_wrap">
                            <div class="start1" v-for="i in item.synthesizeLevel"></div>
                        </div>
                        </div>
                    </div>
                    <div class="img_wrap">
                        <img v-for='(img,index) in item.filePathList' v-if="img.fileType==1" @click.stop="$api.showImgDetail(img.filePath)" :src=$api.formatterImg(img.filePath) />
                    </div>
                    <div class="audio_wrap">
                        <audio v-for='(audio,index) in item.filePathList' v-if="audio.fileType==2" :src=audio.filePath></audio>
                    </div>
                    <div class="dianping">{{item.bodyComment}}</div>
                </li>
                </div>
                <div v-if="i=='recipeList'" class="flex_column text_row2">
                    <div class="row_title">{{formatTitle(i)}}</div>
                    <span v-if="detail[i].length==0">
                            无
                    </span>
                    
                    <div>
                        <ul>
                            <li v-for='(item,index) in detail[i]' class="wrap">
                                <div class="personal flex_wrap">
                                    <div class="touxiang" style="flex-shrink:0;">
                                        <img :src="item.userPhoto" />
                                    </div>
                                    <div class="useinfo" style="width:auto;">
                                        <div class="usename">{{item.userName}}</div>
                                        <p class="dianping" >{{item.content}}</p>
                                    </div>
                                </div>
                                <div class="img_wrap" >
                                    <img  v-for='(img,index) in item.filePathList' @click.stop="$api.showImgDetail(img.filePath)" :class="{height_auto:item.filePathList.length==1,minImage:item.filePathList.length!=1}" v-if="img.fileType==1" :src=$api.formatterImg(img.filePath) />
                                </div>
                                <div class="audio_wrap">
                                    <audio v-for='(audio,index) in item.filePathList' v-if="audio.fileType==2"  :src=audio.filePath ></audio>
                                </div>
                                <div class="time">{{new Date(item.createTime).Format('yyyy-MM-dd hh:mm')}}</div>
                            </li>
                        </ul>
                    </div>
                </div>
                <div v-if="i=='tsHealthEntity'" class="flex_column text_row2">
                    <div class="row_title">{{formatTitle(i)}}</div>
                    <span v-if="detail[i].length==0">
                            无
                    </span>
                    <div>
                        <div >
                        <span v-if="detail[i].temperatureType=='0'">体温:正常 </span>
                        <span v-if="detail[i].temperatureType==null">体温:无 </span>
                        <span v-if="detail[i].temperatureType=='1'">体温:发烧  &nbsp; 度数:{{detail[i].feverNum/10}}℃ </span>
                        </div>
                        <div >
                        <span>身高:{{detail[i].height?detail[i].height:0}}cm  &nbsp; 体重:{{detail[i].weight?detail[i].weight:0}}kg </span>
                        </div>
                        <div >
                        <span>左眼:{{detail[i].leftSight/10}} &nbsp;  右眼:{{detail[i].rightSight/10}}&nbsp;  双眼:{{detail[i].bothSight/10}} </span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</template>
<script>
    import {
        MessageBox
    } from 'mint-ui'
    export default {
        created() {
            this.getUseInfo();
            this.getDetail();
        },

        data() {
            return {
                detail: '',
                useInfo: '',
            }
        },
        methods: {
            formatType(markFlag) {
                switch (markFlag) {
                    case 1:
                        return '签到';
                        break;
                    case 3:
                        return '签退';
                        break;
                    case 2:
                        return '请假';
                        break;
                }
            },
            formatTitle(i) {
                switch (i) {
                    case 'noonList':
                        return '午托:';
                        break;
                    case 'nightList':
                        return '晚托:';
                        break;
                    case 'lessonList':
                        return '课程:';
                        break;
                    case 'taskList':
                        return '作业点评:';
                        break;
                    case 'examList':
                        return '试卷点评:';
                        break;
                    case 'tsHealthEntity':
                        return '健康情况:';
                        break;
                    default:
                        return '食谱:';
                        break;
                }
            },
            getUseInfo() {

                this.useInfo = JSON.parse(sessionStorage.getItem('useInfo'));
                this.useInfo.studentList.forEach(element => {
                    if (element.checked) {
                        this.studentId = element.studentId
                    }
                });
            },
            getDetail() {
                var url = "mark/selectDayData"
                var params = {
                    schoolId: this.useInfo.schoolId,
                    studentId: this.studentId,
                }
                this.$api.post(url, params, o => {
                    console.log(JSON.parse(JSON.stringify(o)));
                    this.detail = o.info
                })
            }
        },
    }
</script>
<style scoped>
    .wrap {
        text-align: left;
    }
</style>